function EnemyPlane(type) {
	this.init = function() {
		
		this.body = create("div");
		new GameEngine().append(this);
		switch(type) {
			case "small":
				{
					this.body.className = "enemy-small";
					this.imgArr=["plane1_die1","plane1_die2","plane1_die3"]
					this.body.style.left = Math.max(0, Math.random() * (new GameEngine().width() - this.width())) + "px";
					this.speed = 8;
					this.score=1;
					this.body.style.top = -this.height() + "px";
					this.hp = 1;
				}
				break;
			case "middle":
				{
					this.body.className = "enemy-middle";
					this.imgArr=["plane2_die1","plane2_die2","plane2_die3","plane2_die4"]
					this.body.style.left = Math.max(0, Math.random() * (new GameEngine().width() - this.width())) + "px";
					this.speed = 6;
					this.score=5;
					this.body.style.top = -this.height() + "px";
					this.hp = 3;
				}
				break;
			case "large":
				{
					this.body.className = "enemy-large";
					this.imgArr=["plane3_die1","plane3_die2","plane3_die3","plane3_die4","plane3_die5","plane3_die6"]
					this.body.style.left = Math.max(0, Math.random() * (new GameEngine().width() - this.width())) + "px";
					this.speed = 2;
					this.score=10;
					this.body.style.top = -this.height() + "px";
					this.hp = 8;
				}
				break;
		}
		this.move();
		return this;
	}
	this.width = function() {
		return this.body.offsetWidth;
	}
	this.height = function() {
		return this.body.offsetHeight;
	}
	this.top=function(){
		return this.body.offsetTop;
	}
	this.left=function(){
		return this.body.offsetLeft;
	}
	this.move = function() { //移动
		this.timer = setInterval(function() {
			this.body.style.top = this.body.offsetTop + this.speed + "px";
			if(this.top()>new GameEngine().height()){
				this.disapper();
				clearInterval(this.timer);
			}
		}.bind(this), 30)
	}
	this.hurt=function(){
		/*this.hp--;
		if(this.hp==0){
			this.explode();
		}*/
		--this.hp==0?this.explode():"";
	}
	this.fire = function() { //开火

	}
	this.explode = function() { //爆炸
		new GameEngine().enemes.delete(this);
		clearInterval(this.timer);
		var dieTimer=setInterval(function(){
			if(this.imgArr.length==0){
				clearInterval(dieTimer);
				this.body.remove();
				new GameEngine().count+=this.score;
				new GameEngine().score.innerHTML=new GameEngine().count;
			}
			this.body.style.background=`url(images/${this.imgArr.shift()}.png)`;
		}.bind(this),100)
	}
	this.disapper=function(){
		this.body.remove();
	}
}